import grpc

from grpc_metadata_test.proto import hello_pb2_grpc, hello_pb2

if __name__ == '__main__':
    with grpc.insecure_channel("localhost:50051") as channel:
        stub = hello_pb2_grpc.GreeterStub(channel)
        hello_request = hello_pb2.HelloRequest()
        hello_request.name = "bobby"
        response, call = stub.SayHello.with_call(
            hello_request,
            metadata=(
                ("name", "booby"),
                ("password", "imooc")
            )
        )
        print(response.message)
